Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/navigation component #100

Merged
merged 8 commits into from
Jul 13, 2017
Merged

Conversation

gregorykan
Copy link
Contributor

@gregorykan gregorykan commented Jul 13, 2017

closes #95

Copy link
Member

@ahdinosaur ahdinosaur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yay, this is cool.

constructor (props) {
super(props)
this.state = {
drawerOpen: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm a fan of is* boolean props, so isDrawerOpen. helps disambiguate from thinking that this is a function which opens the drawer. what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A++ i agree

class Navigation extends React.Component {
constructor (props) {
super(props)
this.state = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i know i mentioned this before, but what do you think about using recompose to handle stateful or lifecycle components? while i did say "functional purity" can be a trap, i am enjoying using recompose so far.

so this would be:

import { connect as connectFela } from 'react-fela'
import { withState, withHandlers } from 'recompose'
import { pipe, not } from 'ramda'

import styles from '../styles/Navigation'

const Navigation = (props) => {
  // render...
}

export default pipe(
  connectFela(styles),
  withState('isDrawerOpen', 'setDrawerOpen', false),
  withHandlers({
    toggleDrawer: ({ setDrawerOpen }) => () => setDrawerOpen(not)
  })
)(Navigation)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeaaaahhh nice ! i wanted to ask you how to do this actually - will give it a go!

}

export default pipe(
connectFela(styles)
export default compose(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call on using recompose.compose 👍

drawerOpen: false
}
}
function Navigation (props) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beautiful! 😺

@ahdinosaur ahdinosaur merged commit 9be488c into master Jul 13, 2017
@ahdinosaur ahdinosaur removed the review label Jul 13, 2017
@ahdinosaur ahdinosaur modified the milestone: sprint 2 Jul 20, 2017
@ahdinosaur ahdinosaur modified the milestones: sprint 2, beta 1 Aug 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

component: Navigation
2 participants